import { Router } from "express";
import { getToken } from "../../../utils/token";
import { useUuid } from "../../../utils/uuid";
import { useSetToken } from "../../../hooks/useRedis";
import { BasicsResult } from "../../../helpers/BasicsResult";
import { createData } from "../../../db/dispose";
import { userSchemas } from "../../../db/model";

const userRouter = Router();

/**
 * 登录接口
 */
userRouter.post("/login", async (req, res) => {});

userRouter.post("/register", async (req, res) => {
  const id = useUuid();
  const token = getToken({ });
  useSetToken(token);
  console.log(req.body);

  await createData(userSchemas, req.body);
  res.json(BasicsResult.success(null));
});


export default userRouter;
